<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.0.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/logo.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/logo.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"example.com","root":"/","images":"/images","scheme":"Mist","darkmode":false,"version":"8.10.0","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

  <meta name="description" content="CMake是一个跨平台的构架工具，它本身并不参与构建，而是通过解析CMakeLists.txt来生成Makefile，最终完成构建。使用CMake的本质就是学习如何正确编写CMakelists.txt来表示项目的构建规则。">
<meta property="og:type" content="article">
<meta property="og:title" content="C++项目组织构建工具CMake">
<meta property="og:url" content="http://example.com/2021/10/16/cmake/index.html">
<meta property="og:site_name" content="chenchu.zs&#39;s blog">
<meta property="og:description" content="CMake是一个跨平台的构架工具，它本身并不参与构建，而是通过解析CMakeLists.txt来生成Makefile，最终完成构建。使用CMake的本质就是学习如何正确编写CMakelists.txt来表示项目的构建规则。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://example.com/2021/10/16/cmake/build.png">
<meta property="article:published_time" content="2021-10-16T10:53:43.000Z">
<meta property="article:modified_time" content="2022-07-31T10:27:36.434Z">
<meta property="article:author" content="Zhang Shu">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://example.com/2021/10/16/cmake/build.png">


<link rel="canonical" href="http://example.com/2021/10/16/cmake/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://example.com/2021/10/16/cmake/","path":"2021/10/16/cmake/","title":"C++项目组织构建工具CMake"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>C++项目组织构建工具CMake | chenchu.zs's blog</title>
  





  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">chenchu.zs's blog</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">仓鼠君的瓜子库</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
        <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#cmake%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8"><span class="nav-number">1.</span> <span class="nav-text">cmake的基本使用</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#vscode%E6%8F%92%E4%BB%B6%E4%BD%BF%E7%94%A8"><span class="nav-number">1.1.</span> <span class="nav-text">vscode插件使用</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%AE%BE%E7%BD%AEbuild-type"><span class="nav-number">1.2.</span> <span class="nav-text">设置build type</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%AE%BE%E7%BD%AEverbose-makefile"><span class="nav-number">1.3.</span> <span class="nav-text">设置verbose makefile</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%AE%BE%E7%BD%AE%E7%BC%96%E8%AF%91%E8%AF%AD%E8%A8%80"><span class="nav-number">1.4.</span> <span class="nav-text">设置编译语言</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%AE%BE%E7%BD%AEC-%E6%A0%87%E5%87%86"><span class="nav-number">1.5.</span> <span class="nav-text">设置C++标准</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%AE%BE%E7%BD%AEC-%E7%BC%96%E8%AF%91%E9%80%89%E9%A1%B9"><span class="nav-number">1.6.</span> <span class="nav-text">设置C++编译选项</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#CMake%E9%A1%B9%E7%9B%AE%E7%AE%A1%E7%90%86"><span class="nav-number">2.</span> <span class="nav-text">CMake项目管理</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%8C%87%E5%AE%9Ainclude%E8%B7%AF%E5%BE%84"><span class="nav-number">2.1.</span> <span class="nav-text">指定include路径</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%8C%87%E5%AE%9A%E4%BE%9D%E8%B5%96%E5%BA%93%E7%9A%84%E8%B7%AF%E5%BE%84"><span class="nav-number">2.2.</span> <span class="nav-text">指定依赖库的路径</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%AE%BE%E7%BD%AEinstall%E8%A7%84%E5%88%99"><span class="nav-number">2.3.</span> <span class="nav-text">设置install规则</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Zhang Shu"
      src="/images/avatar.gif">
  <p class="site-author-name" itemprop="name">Zhang Shu</p>
  <div class="site-description" itemprop="description">积跬步以致千里</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">13</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/chenchu-zs" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;chenchu-zs" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/10/16/cmake/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Zhang Shu">
      <meta itemprop="description" content="积跬步以致千里">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="chenchu.zs's blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          C++项目组织构建工具CMake
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-10-16 18:53:43" itemprop="dateCreated datePublished" datetime="2021-10-16T18:53:43+08:00">2021-10-16</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2022-07-31 18:27:36" itemprop="dateModified" datetime="2022-07-31T18:27:36+08:00">2022-07-31</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/c/" itemprop="url" rel="index"><span itemprop="name">c++</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>2k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>2 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p>CMake是一个跨平台的构架工具，它本身并不参与构建，而是通过解析CMakeLists.txt来生成Makefile，最终完成构建。<br>使用CMake的本质就是学习如何正确编写CMakelists.txt来表示项目的构建规则。</p>
<span id="more"></span>
<h1 id="cmake的基本使用"><a href="#cmake的基本使用" class="headerlink" title="cmake的基本使用"></a>cmake的基本使用</h1><p>以一个简单的demo项目为例来总结CMakeLists.txt的基本使用方式。<br>现在我们要实现一个简单的支持四则运算的计算器，命名为CalculatorDemo</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">mkdir</span> CalculatorDemo</span><br><span class="line"><span class="built_in">cd</span> CalculatorDemo</span><br></pre></td></tr></table></figure>
<h2 id="vscode插件使用"><a href="#vscode插件使用" class="headerlink" title="vscode插件使用"></a>vscode插件使用</h2><p>我们可以使用vscode的CMake Tools插件来加快开发速度。<br>命令面板输入 <code>Cmake:Quick Start</code>, 然后指定编译器版本、项目名称和构建目标(library or executable)，然后系统会自动的在CalculatorDemo下创建两个文件如下：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">.</span><br><span class="line">├── CMakeLists.txt</span><br><span class="line">└── CalculatorDemo.cpp</span><br></pre></td></tr></table></figure>
<p>其中CMakeLists.txt如下，我添加了一些中文注释来解释其中的含义</p>
<figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 指定项目编译所需的最低cmake版本</span></span><br><span class="line"><span class="keyword">cmake_minimum_required</span>(VERSION <span class="number">3.0</span>.<span class="number">0</span>)</span><br><span class="line"><span class="comment"># 指定项目名称和版本</span></span><br><span class="line"><span class="keyword">project</span>(CalculatorDemo VERSION <span class="number">0.1</span>.<span class="number">0</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># include(CTest)</span></span><br><span class="line"><span class="comment"># enable_testing()</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 编译CalculatorDemo.cpp为一个libray</span></span><br><span class="line"><span class="keyword">add_library</span>(CalculatorDemo CalculatorDemo.cpp)</span><br><span class="line"></span><br><span class="line"><span class="comment"># set(CPACK_PROJECT_NAME $&#123;PROJECT_NAME&#125;)</span></span><br><span class="line"><span class="comment"># set(CPACK_PROJECT_VERSION $&#123;PROJECT_VERSION&#125;)</span></span><br><span class="line"><span class="comment"># include(CPack)</span></span><br></pre></td></tr></table></figure>
<blockquote>
<ul>
<li>CPack和CTest是插件为我们自动添加的测试和打包模块，先注释掉，后面再总结。其他的是构建项目的必须部分。</li>
</ul>
</blockquote>
<p>编写一个简单的build.sh构建</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">set -x</span><br><span class="line">rm build -rf</span><br><span class="line">mkdir build</span><br><span class="line">cd build</span><br><span class="line">cmake ..</span><br><span class="line">make -j</span><br></pre></td></tr></table></figure>
<p><img src="/2021/10/16/cmake/build.png" alt="image.png"><br>可以看到成功编译了一个名为libCalculatorDemo.a的静态库文件。</p>
<p>现在我们要对这个CMakeLists.txt进行一些修改。</p>
<h2 id="设置build-type"><a href="#设置build-type" class="headerlink" title="设置build type"></a>设置build type</h2><p>一共有四种可选项：<code>Debug/Release/RelWithDebInfo/MinSizeRel</code></p>
<figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span> (<span class="keyword">NOT</span> CMAKE_BUILD_TYPE)</span><br><span class="line">  <span class="keyword">set</span>(CMAKE_BUILD_TYPE <span class="string">&quot;Release&quot;</span> CACHE <span class="keyword">STRING</span> <span class="string">&quot;Choose the type of build,</span></span><br><span class="line"><span class="string">    options are: Debug/Release/RelWithDebInfo/MinSizeRel.&quot;</span> FORCE)</span><br><span class="line"><span class="keyword">endif</span>()</span><br></pre></td></tr></table></figure>
<h2 id="设置verbose-makefile"><a href="#设置verbose-makefile" class="headerlink" title="设置verbose makefile"></a>设置verbose makefile</h2><p>该参数在开发调试时可以方便的查看编译命令是否正确</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">set(CMAKE_VERBOSE_MAKEFILE ON)</span><br></pre></td></tr></table></figure>
<h2 id="设置编译语言"><a href="#设置编译语言" class="headerlink" title="设置编译语言"></a>设置编译语言</h2><figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># project中指定默认的编译语言</span></span><br><span class="line"><span class="keyword">project</span>(CalculatorDemo LANGUAGES C CXX VERSION <span class="number">0.1</span>.<span class="number">0</span>)</span><br><span class="line"><span class="comment"># 启用某种语言，比如CUDA</span></span><br><span class="line"><span class="keyword">enable_language</span>(CUDA)</span><br></pre></td></tr></table></figure>
<h2 id="设置C-标准"><a href="#设置C-标准" class="headerlink" title="设置C++标准"></a>设置C++标准</h2><figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">set</span>(CMAKE_CXX_STANDARD <span class="number">14</span>)</span><br><span class="line"><span class="comment"># 如果不设置，或者为OFF，则指定版本不可用时，会使用上一版本。</span></span><br><span class="line"><span class="keyword">set</span>(CMAKE_CXX_STANDARD_REQUIRED <span class="keyword">ON</span>)</span><br></pre></td></tr></table></figure>
<h2 id="设置C-编译选项"><a href="#设置C-编译选项" class="headerlink" title="设置C++编译选项"></a>设置C++编译选项</h2><p>可以自定义编译选项，比如开启所有的警告<code>-Wall</code>，有两种方式设定编译选项，例如：</p>
<figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">set</span>(CMAKE_CXX_FLAGS <span class="string">&quot;$&#123;CMAKE_CXX_FLAGS&#125; -Wall&quot;</span>)</span><br><span class="line"><span class="keyword">add_compile_options</span>(<span class="string">&quot;-Wall&quot;</span>)</span><br></pre></td></tr></table></figure>
<h1 id="CMake项目管理"><a href="#CMake项目管理" class="headerlink" title="CMake项目管理"></a>CMake项目管理</h1><p>还是上面这个Demo, 一般来说大型的项目通常都包含很多目录和文件，组织项目的时候，源码、头文件、依赖库等都有特定目录。我们修改当前的目录如下：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">.</span><br><span class="line">├── CMakeLists.txt</span><br><span class="line">├── build.sh</span><br><span class="line">├── include</span><br><span class="line">│   └── calculator.h</span><br><span class="line">└── src</span><br><span class="line">    └── calculator.cpp</span><br></pre></td></tr></table></figure>
<h2 id="指定include路径"><a href="#指定include路径" class="headerlink" title="指定include路径"></a>指定include路径</h2><figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 指定某个target的头文件目录</span></span><br><span class="line"><span class="keyword">target_include_directories</span>(CalculatorDemo PUBLIC <span class="keyword">include</span>)</span><br><span class="line"><span class="comment"># 指定全局的头文件目录（不推荐）</span></span><br><span class="line"><span class="keyword">include_directories</span>(<span class="keyword">include</span>)</span><br></pre></td></tr></table></figure>
<h2 id="指定依赖库的路径"><a href="#指定依赖库的路径" class="headerlink" title="指定依赖库的路径"></a>指定依赖库的路径</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="设置install规则"><a href="#设置install规则" class="headerlink" title="设置install规则"></a>设置install规则</h2>
    </div>

    
    
    

    <footer class="post-footer">

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2021/10/09/python-setup/" rel="prev" title="Python包的构建与分发——setup.py">
                  <i class="fa fa-chevron-left"></i> Python包的构建与分发——setup.py
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2021/11/01/conan/" rel="next" title="C++依赖管理conan">
                  C++依赖管理conan <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Zhang Shu</span>
</div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
    <span title="站点总字数">22k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">20 分钟</span>
  </span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/mist/" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  
<script src="https://cdn.jsdelivr.net/npm/hexo-generator-searchdb@1.4.0/dist/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>





  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdn.jsdelivr.net/npm/mathjax@3.2.0/es5/tex-mml-chtml.js","integrity":"sha256-r+3itOMtGGjap0x+10hu6jW/gZCzxHsoKrOd7gyRSGY="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>



</body>
</html>
